﻿using Coldairarrow.Entity.Base_Company;
using Coldairarrow.IBusiness;
using Coldairarrow.Util;
using EFCore.Sharding;
using LinqKit;
using Microsoft.EntityFrameworkCore;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Dynamic.Core;
using System.Threading.Tasks;

namespace Coldairarrow.Business.Base_Company
{
    public class Base_ComapnyHBImgBusiness : BaseBusiness<Base_ComapnyHBImg>, IBase_ComapnyHBImgBusiness, ITransientDependency
    {
        readonly IOperator _Operator;
        public Base_ComapnyHBImgBusiness(IDbAccessor db, IOperator @operator)
            : base(db)
        {
            _Operator = @operator;
        }

        #region 外部接口

        public async Task<PageResult<Base_ComapnyHBImg>> GetDataListAsync(PageInput<ConditionDTO> input)
        {
            var q = GetIQueryable();
            var where = LinqHelper.True<Base_ComapnyHBImg>();
            var search = input.Search;

            //筛选
            //if (search.CompanyId.IsNullOrEmpty())
            //{
            //    search.CompanyId = _Operator.Property.CompanyId;
            //}

            //if (!search.CompanyId.IsNullOrEmpty())
            //{
            //  where =  where.And(x => x.CompanyId == search.CompanyId);
            //}
            //if (!search.Search.IsNullOrEmpty())
            //{
            //    where = where.And(x => x.Name.Contains(search.Search));
            //}
            return await q.Where(where).GetPageResultAsync(input);
        }

       
        

        public async Task<Base_ComapnyHBImg> GetTheDataAsync(string id)
        {
            return await GetEntityAsync(id);
        }

      
        public async Task DeleteDataAsync(List<string> ids)
        {
            await DeleteAsync(ids);
        }

        #endregion

        #region 私有成员

        #endregion
    }
}